/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.garethc.chpt2.alphabet.alphabet.impl;

import za.ac.cput.garethc.chpt2.alphabet.alphabet.Alphabet;

/**
 *
 * @author Gareth
 */
public class AlphabetImpl implements Alphabet
{

    @Override
    public boolean hasAllLetters(String s) 
    {
        String alphabet = "abcdefghijklmnopqrstuvwxyz";
        char[] letters = alphabet.toCharArray();
        boolean hasAll = true;
        
        for (int i = 0; i < letters.length; i++)
        {
            hasAll = false;
            for (int j = 0; j < s.length(); j++)
            {
                if (letters[i] == s.toLowerCase().charAt(j))
                {
                    hasAll = true;
                    break;
                }
            }
            if (hasAll != true) break;
        }
        
        return hasAll;        
    }

    @Override
    public boolean hasUppercaseLetters(String s) 
    {
        String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        char[] letters = alphabet.toCharArray();
        boolean hasUpper = false;
        
        for (int j = 0; j < s.length(); j++) 
        {
            for (int i = 0; i < letters.length; i++)
            {
                if (s.charAt(j) == letters[i])
                {
                    hasUpper = true;
                    break;
                }
            }
            if (hasUpper == true) break;
        }
        return hasUpper;
    }
    
}
